<?php
require('global.php');
require('public_data.php');

$smarty->assign('guestbook_title',$arr_priv['guestbook_title']);
$smarty->assign('guestbook_text',$arr_priv['guestbook_text']);

require('comon/subpage.class.php'); 
/*下面是翻页*/
$result_total = $db->query('select id from p_guestbook');
//总条目数
$rows = $db->fetch_array_all();
$total = count($rows);

//每页显示的条数
$page_size=15;
//每次显示的页数
$sub_pages=10;
//得到当前是第几页
$pageCurrent=$_GET["p"];
$subPages=new SubPages($page_size,$total,$pageCurrent,$sub_pages,"guestbook.php?p=",2);
$limitNum = $subPages->getLimt();
$result = $db->query('select * from p_guestbook order by id desc limit '.$limitNum.','.$page_size);
$msg_arr = $db->fetch_array_all();
$pageBar = $subPages->showBar();
$smarty->assign('msg_arr',$msg_arr);
$smarty->assign('pageBar',$pageBar);

$smarty->display('guestbook.html');
?>